"""
弹性层 (Resilience Layer)

为数据源适配器提供弹性保障机制。

主要组件：
1. 熔断器 (Circuit Breaker) - 防止级联故障
2. 限流器 (Rate Limiter) - 控制请求频率
3. 重试机制 (Retry) - 自动重试失败请求
4. 超时控制 (Timeout) - 防止长时间阻塞

作者: RedFire Team
创建日期: 2025-10-06
版本: v1.0
"""

from app.resilience.circuit_breaker import (
    CircuitBreaker,
    CircuitBreakerState,
    CircuitBreakerConfig,
    CircuitBreakerOpenError
)
from app.resilience.rate_limiter import (
    RateLimiter,
    TokenBucketRateLimiter,
    SlidingWindowRateLimiter,
    RateLimitExceededError
)
from app.resilience.retry import (
    RetryPolicy,
    ExponentialBackoffRetry,
    FixedDelayRetry
)
from app.resilience.timeout import (
    TimeoutManager,
    TimeoutError as ResilienceTimeoutError
)

__all__ = [
    # Circuit Breaker
    "CircuitBreaker",
    "CircuitBreakerState",
    "CircuitBreakerConfig",
    "CircuitBreakerOpenError",
    
    # Rate Limiter
    "RateLimiter",
    "TokenBucketRateLimiter",
    "SlidingWindowRateLimiter",
    "RateLimitExceededError",
    
    # Retry
    "RetryPolicy",
    "ExponentialBackoffRetry",
    "FixedDelayRetry",
    
    # Timeout
    "TimeoutManager",
    "ResilienceTimeoutError",
]

